<template>
  <div class="home">
    <!-- 首页搜索框 -->
    <van-search
      v-model="SearchVal"
      @click="$router.push('/home/searchPopup')"
      shape="round"
      placeholder="请输入搜索关键词"
      disabled
    />
    <!-- 轮播图 -->
    <van-swipe
      class="my-swipe"
      :autoplay="3000"
      indicator-color="white"
    >
      <van-swipe-item
        v-for="item in banner"
        :key="item.id"
      >
        <img
          :src="item.image_url"
          alt=""
          width="100%"
          :style="{display:'block'}"
        >
      </van-swipe-item>
    </van-swipe>
    <transition name="van-slide-left">
      <router-view></router-view>
    </transition>
  </div>
</template>
 
<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'
import {getHomeList} from '@/request/api'

export default {
  name: 'Home',
  data() { 
    return {
      SearchVal:"",
      banner:[]
    }
  },
  created(){
    getHomeList()
    .then(res=>{
      console.log("封装success");
      console.log(res.data.banner);
      this.banner = res.data.banner;
    })
    .catch(err=>{
      console.log("error");
      console.log(err);
    })
  },
  components: {

  }
}
</script>

<style lang="less">
 /* .slide-enter,.slide-leave-to{   
    right:-100%;
  }
  .slide-enter-active,.slide-leave-active{
    transition:all .2s;
  }
  .slide-enter-to,.slide-leave{  
     right:0;
  }*/
</style>